import { App, h, Component } from "vue";
import SvgIcon from "@/icons/svg-icon.vue";
import ElIcons from "@/icons/common/el-icons";
import SvgIcons from "@/icons/common/svg-icons";
import NpIcons from "@/icons/common/np-icons";
import { NIcon } from "@/naive-ui";

export interface NIconOptions {
	color?: string;
	depth?: 1 | 2 | 3 | 4 | 5;
	size?: number | string;
}
export function renderXIcon(icon: Component, options: NIconOptions = {}) {
	return () => h(NIcon, options, { default: () => h(icon) });
}

export function renderCIcon(icon: string) {
	return () => h("i", { class: icon });
}

export function renderSIcon(icon: string, options: NIconOptions = {}) {
	return () => h(NIcon, options, { default: () => h(SvgIcon, { name: icon }) });
}
export { SvgIcon, ElIcons, SvgIcons, NpIcons };

export default {
	install(app: App) {
		app.component("SvgIcon", SvgIcon);
	},
};
